package com.cxyzy.glidedemo

import android.app.Activity
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.cxyzy.utils.ext.startActivity
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        gifDemoBtn.jumpToActivityWhenClick<GifActivity>()
        simpleDemoBtn.jumpToActivityWhenClick<SimpleActivity>()
        roundCornerAndCenterCropDemoBtn.jumpToActivityWhenClick<RoundCornerAndCenterCropActivity>()
        custModuleDemoBtn.jumpToActivityWhenClick<CustModuleActivity>()
        rotateDemoBtn.jumpToActivityWhenClick<RotateActivity>()
        filterDemoBtn.jumpToActivityWhenClick<FilterActivity>()
    }

    private inline fun <reified T : Activity> View.jumpToActivityWhenClick() = this.setOnClickListener { startActivity<T>() }

}
